#include<bits/stdc++.h>
using namespace std;
const int ND=20;
int n,m,d[ND],ok[ND][ND][2][2],f[ND][ND][2][2];
int F(int p,int pre,bool limit,bool lead0){
    if(p==0) return 1;
    if(ok[p][pre][limit][lead0]) return f[p][pre][limit][lead0];
    ok[p][pre][limit][lead0]=1;
    f[p][pre][limit][lead0]=0;
    for(int i=0;i<=(limit?d[p]:9);i++){
        if(!lead0&&abs(i-pre)<2) continue;
        f[p][pre][limit][lead0]+=F(p-1,i,limit&&i==d[p],lead0&&i==0);
    }
    return f[p][pre][limit][lead0];
}
int solve(int x){
    memset(ok,0,sizeof(ok));
    memset(f,0,sizeof(f));
    int nD=0;
    do{
        d[++nD]=x%10;
        x/=10;
    }while(x);
    return F(nD,0,1,1);
}
int main(){
    //freopen("volatility.in","r",stdin);
    //freopen("volatility.out","w",stdout);
    cin>>n>>m;
    cout<<solve(m)-solve(n-1)<<endl;
    return 0;
}